<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" 
      th:replace="~{layout/layout :: layout(~{::title}, ~{::section})}">
<head>
    <title>用户列表</title>
</head>
<body>
    <section>
        <h2>用户列表</h2>
        
        <div th:if="${users.empty}" class="alert alert-error">
            暂无注册用户。
        </div>
        
        <table th:if="${!users.empty}">
            <thead>
                <tr>
                    <th>ID</th>
                    <th>姓名</th>
                    <th>邮箱</th>
                    <th>性别</th>
                    <th>出生日期</th>
                    <th>职业</th>
                    <th>婚姻状况</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                <tr th:each="user : ${users}">
                    <td th:text="${user.id}">1</td>
                    <td th:text="${user.fullName}">张三</td>
                    <td th:text="${user.email}">zhangsan@example.com</td>
                    <td th:text="${user.gender.displayName}">男</td>
                    <td th:text="${#temporals.format(user.birthday, 'yyyy-MM-dd')}">1990-01-01</td>
                    <td th:text="${user.profession}">工程师</td>
                    <td th:text="${user.married ? '已婚' : '未婚'}">已婚</td>
                    <td class="action-links">
                        <a th:href="@{/users/{id}(id=${user.id})}" title="查看详情">查看</a>
                        <a th:href="@{/users/delete/{id}(id=${user.id})}" class="delete" title="删除用户" 
                           onclick="return confirm('确定要删除此用户吗？')">删除</a>
                    </td>
                </tr>
            </tbody>
        </table>
        
        <div class="btn-group">
            <a th:href="@{/users/register}" class="btn">添加新用户</a>
        </div>
    </section>
</body>
</html> 